package com.example.demo.controller;


import com.example.demo.entity.ReturnData;
import com.example.demo.entity.TUser;
import com.example.demo.service.TUserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 * 用户表 前端控制器
 * </p>
 *
 * @author lands
 * @since 2024-11-05
 */
@RestController
@Slf4j
@RequestMapping("/t-user")
public class TUserController {
    @Autowired
    TUserService tUserService;
    @GetMapping("list")
    List<TUser> list(){
        return tUserService.getList();
    }

    @PostMapping("login")
    ReturnData login(@RequestBody TUser tUser){
       return tUserService.login(tUser);
    }
    //注册接口
    @PostMapping("register")
    ReturnData register(@RequestBody TUser tUser){
        return tUserService.register(tUser);
    }
    //获取验证码接口
    @PostMapping("getCode")
    ReturnData getCode(String email) throws InterruptedException {

        return  tUserService.getCode(email);
    }
}

